import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bilibili/core/extension/int_extension.dart';
import 'package:flutter/services.dart';
import 'init_items.dart';

class MainScreen extends StatefulWidget {
  static final routName = "/";
  const MainScreen({Key? key}) : super(key: key);

  @override
  _MainScreenState createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen> {
  int _index = 0;
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: () {
        SystemChannels.textInput.invokeListMethod('TextInput.hide');
      },
      child: Scaffold(
        body: IndexedStack(
          index: _index,
          children: pages,
        ),
        bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          backgroundColor: Colors.white,
          showUnselectedLabels: true,
          currentIndex: _index,
          items: items,
          onTap: (index) {
            setState(() {
              _index = index;
            });
          },
          selectedItemColor: Colors.pinkAccent,
          unselectedItemColor: Colors.black,
          unselectedFontSize: 20.px,
          selectedFontSize: 20.px,

        ),

      ),
    );
  }
}
